<?php session_start();
/* generate the page name */
$page = isset($_GET['page'])?$_GET['page']:'';
/* Have a default page if there is no page configured for this request */
$page_name = 'page/home.php';
if(is_file('page/'.$page.'.php'))
{
	$page_name = 'page/'.$page.'.php';
}

/* If the session is not set try and include the login page */
if(empty($_SESSION['name']))
{
	$page_name = 'page/login.php';
}

$host = 'localhost';
$db_name = 'cms';
$username = 'root';
$password = '';

mysql_connect($host, $username, $password);
mysql_select_db($db_name);

include 'functions.php';